'use strict';

/**
 * @param {Egg.Application} app - egg application
 */
module.exports = app => {
  const { router, controller } = app;
  router.get('/', controller.home.index);


  /** ***************************用户表**************************************** */
  /**
   * 注册
   */
  router.post('/register', controller.login.register);
  /**
   * 登录
   */
  router.post('/login', controller.login.login);

  /**
   * 申请授权用户列表接口
   */
  router.get('/getUserListApply', controller.user.getUserListApply);
  /**
   * 获取医护人员列表
   */
  router.get('/getUserListByyihu', controller.user.getUserListByyihu);
  /**
   * 模糊查询的接口
   */
  router.post('/likeQuerying', controller.user.likeQuerying);
  /**
   * 普通用户接口
   */
  router.get('/getUserList', controller.user.getUserList);

  /**
 * 通过token获取用户信息
 */
  router.get('/getUserInfo', controller.user.getUserInfo);

  /**
   * 添加申请授权用户
   */
  router.post('/addApplyUser', controller.curd.addApplyUser);

  /**
   * 审批
   */
  router.post('/approvingUser', controller.user.approvingUser);
  /**
   * 删除用户信息的接口
   */
  router.get('/deleteUser/:id', controller.curd.deleteUser);

  /**
   * 获取护工接口
   */
  router.get('/getHugong', controller.user.getHugong);

  /**
   * 上传头像接口
   */
  router.post('/uploadUser', controller.user.uploadUser);

  /**
   * 根据id查找用户的接口
   */
  router.get('/getDataByPk/:id', controller.curd.getDataByPk);

  /**
   * 获取医护详细
   */
  router.get('/geYihuDetail/:id', controller.user.geYihuDetail);


  /**
   * 更新用户信息的接口
   */
  router.post('/updateUser', controller.curd.updateUser);
  /** ***************************用户信息表**************************************** */
  /**
 * 添加用户信息
 */
  router.post('/addUserInfo', controller.userInfo.addUserInfo);
  /**
 * 获取关联的父母信息
 */
  router.get('/getUserInfoList/:id', controller.userInfo.getUserInfoList);

  /** **************************公告表********************************************* */
  router.get('/announce', controller.announce.announce);
  router.get('/announcecontent', controller.announce.content);
  /**
    * 获取公告列表
    */
  router.get('/getAnnounceList', controller.announce.getAnnounceList);
  /**
    * 获取未审核的公告列表接口
    */
  router.get('/getAnnounceListByApproval', controller.announce.getAnnounceListByApproval);
  /**
   * 查询已启用的科普文章
   */
  router.get('/getAnnounceListByQiYong', controller.announce.getAnnounceListByQiYong);
  /**
    * 保存公告
    */
  router.post('/saveAnnounce', controller.announce.saveAnnounce);

  /**
    * 审批公告
    */
  router.post('/approvingAnnounce', controller.announce.approvingAnnounce);

  /**
  * 更新公告接口
  */
  router.post('/update', controller.announce.update);

  /**
    * 模糊查询公告接口
    */
  router.post('/selectAnnouncesByLike', controller.announce.selectAnnouncesByLike);

  /**
    * 删除公告接口
    */
  router.get('/deleteAnnounce/:id', controller.announce.deleteAnnounce);

  /**
    * 通过城市编码获取公告列表
    */
  router.get('/getListByRegion/:cityCode', controller.announce.getListByRegion);
  /**
    * 公告详细界面数据接口
    */
  router.post('/getAnnounceDetail', controller.announce.getAnnounceDetail);
  /**
    * 点赞
    */
  router.get('/addLiked/:id', controller.announce.addLiked);
  /**
    * 找出用户订阅的公告接口
    */
  router.post('/getAnnounceByUserSub', controller.announce.getAnnounceByUserSub);

  /** **********************订阅表************************************/
  /**
    * 新增订阅接口
    */
  router.post('/addSubscribe', controller.subscribe.addSubscribe);
  /**
    * 取消订阅
    */
  router.post('/cancelSub', controller.subscribe.cancelSub);

  router.post('/addRelease', controller.release.addRelease);

  /** ********************预约表************************ */

  /**
   * 保存预定结果
   */
  router.post('/saveReservation', controller.reservation.saveReservation);


  router.post('/saveResult', controller.reservation.saveResult);

  /**
   *
   */
  router.post('/getMessages', controller.reservation.getMessages);

  router.post('/getMessagesByShouhuo', controller.reservation.getMessagesByShouhuo);

  router.get('/getOrderDetail/:orderId', controller.reservation.getOrderDetail);

};
